{% extends "base.html" %}

{% block title %}
    职位管理
{% endblock %}

{% block head %}
    <h1 class="page-header">
        财务部-职位管理
        <a class="btn btn-default pull-right" data-toggle="modal" data-target="#add_modal">添加</a>
    </h1>
{% endblock %}

{% block content %}
    <div class="col-lg-12">
        <div class="row">
            <table class="table">
                <thead>
                <tr>
                    <th>职位名称</th>
                    <th>职位等级</th>
                    <th>职位操作</th>
                </tr>
                </thead>
                <tbody>
                {% for p in position_list %}
                <tr>
                    <td class="col-lg-4">{{ p.p_name }}</td>
                    <td class="col-lg-4">{{ p.p_level }}</td>
                    <td class="col-lg-4">
                        <a class="btn btn-default" data-toggle="modal" data-target="#edit_modal" href="/edit_position">编辑</a>
                        <a class="btn btn-default" href="/del_position/{{ p.id }}">删除</a>
                    </td>
                </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>
        <div class="modal" id="add_modal">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span>&times;</span>
                        </button>
                        <h4>新增职位</h4>
                    </div>
                    <div class="modal-body">
                        <form action="/add_position" method="post" enctype="multipart/form-data">
                            <div class="form-group">
                                <label class="control-label">职位名称：</label>
                                <input class="form-control" type="text" name="name">
                                <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                            </div>
                            <div class="form-group">
                                <label class="control-label">职位等级：</label>
                                <input class="form-control" type="number" name="level">
                            </div>
                            <div class="form-group">
                                <button class="btn btn-primary btn-block">提交</button>
                            </div>
                        </form>
                    </div>
                    <!--
                    <div class="modal-footer"></div>
                    -->
                </div>
            </div>
        </div>
        <div class="modal" id="edit_modal">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span>&times;</span>
                        </button>
                        <h4>编辑职位</h4>
                    </div>
                    <div class="modal-body">
                        <form action="" method="post">
                            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                            <div class="form-group">
                                <label class="control-label">职位名称：</label>
                                <input class="form-control" type="text" name="name">
                            </div>
                            <div class="form-group">
                                <label class="control-label">职位等级：</label>
                                <input class="form-control" type="number" name="level">
                            </div>
                            <div class="form-group">
                                <button class="btn btn-primary btn-block">提交</button>
                            </div>
                        </form>
                    </div>
                    <!--
                    <div class="modal-footer"></div>
                    -->
                </div>
            </div>
        </div>
    </div>
{#    <script>#}
{#        function edit(id,name,level) {#}
{#            $("#p_id").val(id);#}
{#            $("#p_level").val(level);#}
{#            $("#p_name").val(name);#}
{#        }#}
{#    </script>#}
{% endblock %}